package com.huawei.appmarket.service.store.awk.node;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appmarket.service.store.awk.bean.CombineOrderAppCardBean;
import com.huawei.appmarket.service.store.awk.card.CombineOrderAppCard;
import com.huawei.appmarket.service.store.awk.card.OrderAppCard;
import java.util.ArrayList;
import java.util.List;
import o.azb;
import o.cdr;
import o.cgz;
import o.chy;
import o.chz;
import o.cih;
import o.eir;
import o.CollectCheck;
import o.ewm.h;
import o.ewm.j;

public class CombineOrderAppNode extends cdr {
    private chy ˊ;

    public CombineOrderAppNode(Context context) {
        super(context, 1);
    }

    public int ˏ() {
        return 1;
    }

    public boolean ॱ() {
        return true;
    }

    public ArrayList<String> z_() {
        cgz ˊ = ˊ(0);
        if (ˊ instanceof CombineOrderAppCard) {
            return ((CombineOrderAppCard) ˊ).ˊ();
        }
        return null;
    }

    public boolean ˊ(ViewGroup viewGroup, ViewGroup viewGroup2) {
        LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
        layoutParams.weight = 1.0f;
        LayoutInflater from = LayoutInflater.from(this.ॱ);
        cih combineOrderAppCard = new CombineOrderAppCard(this.ॱ);
        View view = (LinearLayout) from.inflate(h.ՙ, null);
        combineOrderAppCard.ˏ(view);
        ˊ(combineOrderAppCard);
        LinearLayout linearLayout = (LinearLayout) view.findViewById(j.ʿ);
        azb.ˏ(linearLayout);
        LinearLayout.LayoutParams layoutParams2 = (LinearLayout.LayoutParams) linearLayout.getLayoutParams();
        if (layoutParams2 != null) {
            layoutParams2.bottomMargin = 0;
        }
        viewGroup.addView(view, layoutParams);
        return true;
    }

    public boolean ॱ(chz o_chz, ViewGroup viewGroup) {
        this.ˏ = o_chz.ˏ;
        cih ˎ = ˎ(0);
        if (ˎ instanceof CombineOrderAppCard) {
            CombineOrderAppCard combineOrderAppCard = (CombineOrderAppCard) ˎ;
            CardBean ˋ = o_chz.ˋ(0);
            if (ˋ instanceof CombineOrderAppCardBean) {
                ˋ.ˋˋ(String.valueOf(this.ˏ));
                List ॱ = ((CombineOrderAppCardBean) ˋ).ॱ();
                if (CollectCheck.isEmpty(ॱ)) {
                    ˎ.ˉ().setVisibility(8);
                } else {
                    ॱ(combineOrderAppCard, ॱ.size());
                    ˎ.ˏ(ˋ);
                    ˎ.ˉ().setVisibility(0);
                }
            } else {
                ˎ.ˉ().setVisibility(8);
            }
        }
        return true;
    }

    private void ॱ(CombineOrderAppCard combineOrderAppCard, int i) {
        LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
        layoutParams.weight = 1.0f;
        LayoutInflater from = LayoutInflater.from(this.ॱ);
        for (int i2 = 0; i2 < i; i2++) {
            View view = (ViewGroup) from.inflate(h.ʿॱ, null);
            cgz orderAppCard = new OrderAppCard(this.ॱ);
            orderAppCard.ˏ(view);
            combineOrderAppCard.ˏ(orderAppCard);
            View ˉ = combineOrderAppCard.ˉ();
            if (ˉ instanceof ViewGroup) {
                ((ViewGroup) ˉ).addView(view, layoutParams);
            }
        }
        ˋ(this.ˊ);
    }

    public void ˋ(chy o_chy) {
        this.ˊ = o_chy;
        if (ˊ(0) instanceof CombineOrderAppCard) {
            CombineOrderAppCard combineOrderAppCard = (CombineOrderAppCard) ˊ(0);
            combineOrderAppCard.ˏ(o_chy);
            int ˎ = combineOrderAppCard.ˎ();
            for (int i = 0; i < ˎ; i++) {
                cgz ˏ = combineOrderAppCard.ˏ(i);
                View view = null;
                if (ˏ != null) {
                    view = ˏ.ˉ();
                }
                if (view != null) {
                    view.setOnClickListener(new eir(o_chy, ˏ, 0));
                }
            }
            OnClickListener o_eir = new eir(o_chy, combineOrderAppCard, 9);
            combineOrderAppCard.ˋ().setOnClickListener(o_eir);
            combineOrderAppCard.ॱॱ().setOnClickListener(o_eir);
        }
    }
}
